|
|
|
|
|
|
|
vxtAddr1.CheckRequired
vxtCity.CheckRequired
vxtStateProv.CheckRequired
'
' check conditional fields
vxtAddr2.ConditionalValidate vxtAddr2.DataField, vxtAddr1.DataField,
vxtAddr1.Text
vxtFirstName.ConditionalValidate vxtFirstName.DataField,
vxtLastName.DataField, vxtLastName.Text
'
End Sub |
|
|
|
|
|
|
|
|
After you enter this code, you need to add a few lines to the Data1_Validate event. The code in Listing 5.57 calls the validation routine each time the Update button is clicked or the arrow keys are pressed on the data control. |
|
|
|
|
|
|
|
|
Listing 5.57. Calling validation routines when the Update button is pressed. |
|
|
|
|
|
|
|
|
Private Sub Data1_Validate(Action As Integer, Save As Integer)
'
ValidateForm
'
End Sub |
|
|
|
|
|
|
|
|
Today you learned how to perform input validation on data entry forms. You learned that input validation tasks can be divided into three areas: |
|
|
|
|
|
|
|
|
· Key filtering: Preventing unwanted keyboard input |
|
|
|
|
|
|
|
|
· Field-level validation: Validating input for each field |
|
|
|
|
|
|
|
|
· Form-level Validation: Validating input across several fields |
|
|
|
|
|
|
|
|
You also learned that you should ask yourself a few basic questions when you are developing validation rules for your form. |
|
|
|
|
|
|
|
|
· Is it a required field? |
|
|
|
|
|
|
|
|
· What characters are valid/invalid for this field? (Numeric input only, capital letters only, no spaces allowed, and so on.) |
|
|
|
|
|
|
|
|
· For numeric fields, is there a high/low range limit? (Must be greater than zero and less than 1000, can't be less than 100, and so on.) |
|
|
|
|
|